let date = new Date();
let year = date.getFullYear();
let years = [];
var month = date.getMonth();
let months = [];
let day = date.getDate();
let days = [];
var p_currents = {
	current: 0,
	y: [],
	m: [],
	mz: [],
	d: []
};

function fill(a) {
	return 10 > a ? '0' + (0 | a) : a;
}
let yearMinStart = year; //开始年份
let yearMinEnd = yearMinStart - 3; //结束年份

for (let dateStart = yearMinEnd; dateStart <= yearMinStart; dateStart++) {
	years.push(dateStart);
	//console.log("dateStart>>>>", dateStart, year)
	if (dateStart == year) {
		//得到年下标
		p_currents.y.push(years.length - 1);
		p_currents.m.push(years.length - 1);
		p_currents.mz.push(years.length - 1);
		p_currents.d.push(years.length - 1);
	}
}

for (let i = 0; i < 12; i++) {
	months.push(i);
	if (month == i) {
		//得到月下标
		p_currents.m.push(i);
		p_currents.mz.push(i);
		p_currents.d.push(i);
	}
}
let dateM = new Date(yearMinStart, month + 1, 0);
let dayMax = dateM.getDate();
for (let t = 1; t <= dayMax; t++) {
	days.push(t);
	if (t == day) {
		//天下标
		p_currents.d.push(t - 1);
	}
}

// console.log(year, month, day, years, months, days);
module.exports = {
	year,
	month,
	day,
	years,
	months,
	days,
	p_currents
}
